#ifndef EDITWIDGET_H
#define EDITWIDGET_H

#include <QDialog>
#include "common/gui/myView/ttableview.h"
#include "common/gui/myView/abctableview.h"
#include "dataview/usermodel.h"
#include "dataview/userdelegate.h"
#include "common/gui/myView/abclistview.h"
#include "common/gui/myView/tlistview.h"

namespace Ui {
class EditWidget;
}

class EditWidget : public QDialog
{
    Q_OBJECT

public:
    explicit EditWidget(QWidget *parent,QLayout* layout,const QString& columnName,int modelType);
    ~EditWidget();
    enum{
        USERMODEL,
        PRODUCTMODEL,
        CLASSIFIERPRTMODEL
    };

private slots:
    void on_btn_back_clicked();
    void on_btn_new_clicked();

    void on_btn_del_clicked();

protected slots:
    void searchName(const QString&);
    void openEditor(const QModelIndex& index);
    void onUpdateDate();
    void clearSearchText();
    void selectItem(const QModelIndex& index);
signals:
    void selectedItem(const QModelIndex &index);
private:
    Ui::EditWidget *ui;
    QString mColumn;
    QString mTableName;
    TTableView* mTableView;
    QAbstractListModel* mModel;
    UserDelegate* mDelegate;
    int mModelType;

    void setTitleName(const QString&);
};

#endif // EDITWIDGET_H
